#ifndef CSINGLEAPPLICATION_H
#define CSINGLEAPPLICATION_H

#include <QCoreApplication>
#include <QSharedMemory>

class CSingleApplication : public QCoreApplication
{
    Q_OBJECT
public:
    explicit CSingleApplication(int argc, char *argv[], const QString &key = QString("CSingleApplication"));
    ~CSingleApplication();

    bool isRunning();
    bool sendMessage(const QString &message);
    void detach();

public slots:
    void checkForMessage();

signals:
    void messageAvailable(QString message);

private:
    bool _isRunning;
    QSharedMemory sharedMemory;
};

#endif // CSINGLEAPPLICATION_H
